from appium.webdriver.common.appiumby import AppiumBy

from appium_qiyeweixin.page_object.public.base_page import BasePage


class NavMenu(BasePage):

    __ADDRESSBOOK = (AppiumBy.XPATH, "//*[@text='通讯录']")
    __WORKBENCH = (AppiumBy.XPATH, "//*[@text='工作台']")

    def switch_message(self):

        from appium_qiyeweixin.page_object.message_page import MessagePage
        return MessagePage(self.driver)

    def switch_address_book(self):
        self.do_ele_click(self.__ADDRESSBOOK)

        from appium_qiyeweixin.page_object.address_book_page import AddressBookPage
        return AddressBookPage(self.driver)

    def switch_workbench(self):
        self.do_ele_click(self.__WORKBENCH)

        from appium_qiyeweixin.page_object.workbench_page import WorkbenchPage
        return WorkbenchPage(self.driver)